package com.project.controller;

import com.project.bean.StudentBean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("user")
public class UserController {
    @RequestMapping("checkName")
    public String checkName(String userName){
        if ("java".equals(userName)){
            return "ok";
        }else {
            return "no";
        }
    }
    @RequestMapping("getList")
    public List<StudentBean> getList(){
        List<StudentBean> list=new ArrayList<>();
        list.add(new StudentBean(12,"张三", LocalDate.parse("1992-01-12")));
        list.add(new StudentBean(5,"李四",LocalDate.parse("1991-02-18")));
        list.add(new StudentBean(2,"王五",LocalDate.parse("1994-05-02")));
        list.add(new StudentBean(7,"赵六",LocalDate.parse("1992-01-19")));
        list.add(new StudentBean(10,"张六",LocalDate.parse("1991-08-27")));
        return list;
    }
}
